#include<stdio.h>
#include<stdbool.h>
bool Search(int*a ,int key,int se)
{
	int left = 0;
	int right = se - 1;
	while (left <= right)
	{
		int mid = left + right >> 1;
		if (key > a[mid])
		{
			left = mid + 1;
		}
		else if(key<a[mid])
		{
			right = mid - 1;
		}
		else
		{
			return true;
			
		}
	}
	return false;
}
int main()
{
	int a[] = { 1,2,3,4,5,6,7,8 };
	int se = sizeof(a) / sizeof(int);
	if(Search(a, 4, se))
    {
        printf("找到了\n");
    }
    else
    {
        printf("没有找到\n");
    }
	return 0;
}